From ca2c05cdb371e4756444a4428f42825c73b2cced Mon Sep 17 00:00:00 2001 From: =?utf8?q?Timm=20B=C3=A4der?= Date: Sat, 16 Feb 2019 15:29:05 +0100 Subject: [PATCH] widget: Push a transform node if we need to This is the same as the old code since the transformation only contains teh offset right now, but it will be different later where arbitrary transformations are possible per widget. --- gtk/gtkwidget.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c index 26dfa424e1..4e6ea25321 100644 --- a/gtk/gtkwidget.c +++ b/gtk/gtkwidget.c @@ -13528,16 +13528,21 @@ gtk_widget_snapshot_child (GtkWidget *widget, GtkWidget *child, GtkSnapshot *snapshot) { - int x, y; + GtkWidgetPrivate *priv = gtk_widget_get_instance_private (child); + gboolean needs_transform; g_return_if_fail (_gtk_widget_get_parent (child) == widget); g_return_if_fail (snapshot != NULL); - gtk_widget_get_origin_relative_to_parent (child, &x, &y); + needs_transform = !graphene_matrix_is_identity (&priv->transform); + + if (needs_transform) + gtk_snapshot_push_transform (snapshot, &priv->transform); - gtk_snapshot_offset (snapshot, x, y); gtk_widget_snapshot (child, snapshot); - gtk_snapshot_offset (snapshot, -x, -y); + + if (needs_transform) + gtk_snapshot_pop (snapshot); } /** -- 2.30.2